package name.sraynal.msgdispatcher;

import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.*;

import name.sraynal.msgdispatcher.controller.ApplicationController;
import name.sraynal.msgdispatcher.event.Event;
import name.sraynal.msgdispatcher.model.DispatcherModel;
 
public class DispatcherMidlet extends MIDlet implements CommandListener {
    
    public DispatcherMidlet() {
    }
    // Display
    private Display display;
    private  ApplicationController applicationController;
    private DispatcherModel model;
        
    public void startApp() {
    	
    	this.model = new DispatcherModel();
    	this.display = Display.getDisplay(this);
    	this.applicationController = new ApplicationController(model,this.display);
    	this.applicationController.setMidlet(this);
    	this.applicationController.sendEvent(new Event(Event.START_APP));
    }
    
    // Your MIDlet should not call pauseApp(), only system will call this life-cycle method
    public void pauseApp() {
    }
 
    // Your MIDlet should not call destroyApp(), only system will call this life-cycle method    
    public void destroyApp(boolean unconditional) {
    }
 
    public void exitMIDlet() {
        display.setCurrent(null);
        notifyDestroyed();
    }

	public void commandAction(Command arg0, Displayable arg1) {
		// TODO Auto-generated method stub
		
	}
    
}